﻿using System.Collections;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows.Input;
using RG.Common.Export;
using RG.Common.WPF.Commands;

namespace RG.Common.WPF.Frames
{
    [SupportDataBinding]
    public class GenericGridFrameVM : IEditableObject
    {
        public ObservableCollection<IColumnInfo> Columns { get; set; }

        public object Items { get; set; } // ObservableCollection<T>
        public object SelectedItem { get; set; } // T
        public string Notes { get; set; }
        public ICommand ExportToExcelCmd { get; set; }

        public GenericGridFrameVM()
        {
            ExportToExcelCmd = new DelegateCommand(() => ((IEnumerable)Items).ToExcel(Columns), () => true);
        }

        public void BeginEdit()
        {
        }

        public void EndEdit()
        {
        }

        public void CancelEdit()
        {
        }
    }
}
